// #include <os/ioremap.h>
// #include <os/mm.h>
// #include <pgtable.h>
// #include <type.h>
// #include <os/sched.h>

// // maybe you can map it to IO_ADDR_START ?
// static uintptr_t io_base = IO_ADDR_START;
// static ptr_t ioreMemBase = 0x1730000;
// static int top = 0;
// void *ioremap(unsigned long phys_addr, unsigned long size)
// {
//     // TODO: [p5-task1] map one specific physical region to virtual address
//     uint64_t offset = phys_addr & 0xfff;
//     unsigned long all_size = size + offset;
//     ptr_t pgdir = current_running->pgdir;
//     ptr_t user_address = ioreMemBase;
//     int num = all_size / PAGE_SIZE + (all_size % PAGE_SIZE != 0);
//     ptr_t ret = 0;
//     for (int i = 0; i < num; i++)
//     {
//         while (1)
//         {
//             if (srch_mapping(user_address, pgdir))
//                 user_address += PAGE_SIZE;
//             else
//                 break;
//         }
//         ptr_t kv_address = alloc_page_helper(user_address, pgdir, pa2kva(phys_addr), 2);
//         if(i == 0)
//         {
//             ret = kv_address;
//         }
//         phys_addr += PAGE_SIZE;
//         phys_addr &= ~0xfff;
//     }
//     return ret;
// }

// void iounmap(void *io_addr)
// {
//     // TODO: [p5-task1] a very naive iounmap() is OK
//     // maybe no one would call this function?
// }